package cn.admin.system.config.client.impl;

import cn.admin.system.config.client.SysConfigClient;
import cn.admin.system.config.infrastructure.repository.entity.SysConfig;
import cn.admin.system.config.infrastructure.repository.repository.SysConfigRepository;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author YJ
 * @DateTime 2023/2/21 17:47
 */
@Service
public class SysConfigClientImpl implements SysConfigClient {

    @Autowired
    private SysConfigRepository sysConfigRepository;

    @Override
    public Boolean captchaEnabled() {
        SysConfig sysConfig = sysConfigRepository.selectSysConfig("sys.account.captchaEnabled");
        return ObjectUtil.isNotEmpty(sysConfig) && ObjectUtil.isNotEmpty(sysConfig.getConfigValue());
    }
}
